#ifndef __TRIANGLE_H__
#define __TRIANGLE_H__

#include "vector3D.h"
#include "patch.h"
#include "material.h"
#include "ray.h"

namespace t2c2 {
 
class Triangle : public Patch {
public:
	Triangle(Material*,const Vector3D&,const Vector3D&,const Vector3D&);
	Triangle(const Vector3D&,const Vector3D&,const Vector3D&);
	Triangle(void);
	virtual ~Triangle(void);
	
	Vector3D get_vertex(unsigned short) const;
	void set_vertex(unsigned short,const Vector3D&);
	
	virtual double area(void) const;
	virtual Vector3D get_normal(const Vector3D&) const; 
	virtual Vector3D get_sample_point(void) const;
	virtual double intersection(const Ray&);
	
private:
	Vector3D vertices[3];
};

}

#endif
